package com.itxx.anonymousAndLambda.test4;
//接口抽象方法   没有参数  没有返回值

public interface EatAble {
    void eat();
}

class EatImpl implements EatAble{
    @Override
    public void eat() {
        System.out.println("接口实现类实现的吃饭了");
    }
}
class Test1{
    public static void main(String[] args) {
        //接口实现类
        EatImpl e =new EatImpl();
        e.eat();
        //通过匿名内部类
        useEatAble(new EatAble() {
            @Override
            public void eat() {
                System.out.println("匿名内部类实现的吃饭了");
            }
        });
        //lambda表达式实现
        useEatAble(()->{
            System.out.println("lambda实现的吃饭了");
        });
    }

    public static void useEatAble(EatAble eatTest) {
        eatTest.eat();
    }
}